<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
	</ui:define>
	<ui:define name="content">
		<div class='full-center-content-scroll-noheader'>
			<p:outputPanel>
				<div class="nav-tabs-custom" style="height: 855px">
					<ul class="nav nav-tabs">
						<li class="active"><a href="#RiskFactor" data-toggle="tab">风险因素</a></li>
						<li><a href="#RiskLevel" data-toggle="tab">风险等级</a></li>
					</ul>
					<div class="tab-content no-padding">
						<div class="chart tab-pane active" id="RiskFactor">
							<div class="box">
								<div class="box-body  full-content-scroll">
									<h:form id="form1">
										<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
											<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes"
												icon="ui-icon-check" />
											<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no"
												icon="ui-icon-close" />
										</p:confirmDialog>
										<p:growl id="msgs" showDetail="true" />
										<p:toolbar id="btnBar"
											rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxys_xj') or
										s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxys_bj') or
										s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxys_sc')}">
											<f:facet name="left">
												<p:commandButton id="newBtn" value="新建" icon="ui-icon-plus"
													rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxys_xj')}"
													actionListener="#{riskFactorController.createNewFactor}" update="form2:saveDetail btnBar"
													oncomplete="PF('saveRiskFactorDlg').show()" />
												<p:commandButton id="editBtn" value="编辑"
													rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxys_bj')}"
													icon="ui-icon-pencil" actionListener="#{riskFactorController.updateNewFactor}"
													disabled="#{riskFactorController.riskFactor==null}" update="form2:saveDetail btnBar"
													oncomplete="PF('saveRiskFactorDlg').show()" />
												<p:commandButton value="删除" id="delBtn" icon="ui-icon-trash"
													rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxys_sc')}"
													update="factorRecordTb  msgs btnBar"
													disabled="#{riskFactorController.riskFactor==null}"
													actionListener="#{riskFactorController.deleteFactor}">
													<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
												</p:commandButton>
											</f:facet>
										</p:toolbar>
										<p:dataTable var="item" id="factorRecordTb" widgetVar="factorRecordTb" emptyMessage="无记录"
											value="#{riskFactorController.risks}" selectionMode="single"
											selection="#{riskFactorController.riskFactor}" rowKey="#{item.id}" rows="20"
											paginator="true" sortBy="#{item.equType}" paginatorPosition="bottom"
											paginatorTemplate="{Customer} {CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
											rowsPerPageTemplate="10,15,20">
											<p:ajax event="rowSelect" update="form1:btnBar"></p:ajax>
											<f:facet name="{Customer}">
												<p:outputLabel value="总计：#{riskFactorController.risks.size()}条纪录" />
											</f:facet>
											<p:column headerText="所属设备类型" style="text-align: center" groupRow="true">
												<h:outputText value="#{item.equType}" />
											</p:column>
											<p:column headerText="风险因素名称" style="text-align: center">
												<h:outputText value="#{item.name}" />
									    </p:column>
											<p:column headerText="风险因素基础权重" style="text-align: center">
												<h:outputText value="#{item.basicWeight}" />
									    </p:column>
											<p:column headerText="风险因素备注" style="text-align: center">
												<h:outputText value="#{item.riskFactorDesc}" />
									    </p:column>
										</p:dataTable>
									</h:form>
									<h:form id="form2">
										<p:dialog widgetVar="saveRiskFactorDlg" header="风险因素" modal="true" id="saveRiskFactorDlg"
											width="360" height="280">
											<p:toolbar>
												<f:facet name="left">
													<p:commandButton id="saveBtn" value="保存" icon="ui-icon-disk"
														oncomplete="PF('saveRiskFactorDlg').hide()"
														update="form1:factorRecordTb form1:msgs form1:btnBar saveDetail"
														actionListener="#{riskFactorController.saveRiskFactor}" />
												</f:facet>
											</p:toolbar>
											<p:outputPanel id="saveDetail" style="text-align:center;">
												<p:panelGrid columns="2">
													<h:outputText value="风险因素名称" />
													<p:inputText label="name" value="#{riskFactorController.riskFactor.name}"></p:inputText>
													<h:outputText value="风险因素基础权重" />
													<p:inputText label="type" value="#{riskFactorController.riskFactor.basicWeight}"></p:inputText>
													<h:outputText value="风险因素备注" />
													<p:inputText label="type" value="#{riskFactorController.riskFactor.riskFactorDesc}"></p:inputText>
													<h:outputText value="所属设备类型" />
													<p:selectOneMenu id="console" value="#{riskFactorController.riskFactor.equType}"
														style="width:100%">
														<f:selectItem itemLabel="请选择" itemValue="一二次兼有" />
														<f:selectItem itemLabel="一二次兼有" itemValue="一二次兼有" />
														<f:selectItem itemLabel="一次设备" itemValue="一次设备" />
														<f:selectItem itemLabel="二次设备" itemValue="二次设备" />
													</p:selectOneMenu>
												</p:panelGrid>
											</p:outputPanel>
										</p:dialog>
									</h:form>
								</div>
							</div>
						</div>
						<div class="chart tab-pane" id="RiskLevel">
							<div class="box">
								<div class="box-body  full-content-scroll">
									<h:form id="rlform1">
										<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
											<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes"
												icon="ui-icon-check" />
											<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no"
												icon="ui-icon-close" />
										</p:confirmDialog>
										<p:growl id="msgs" showDetail="true" />
										<p:toolbar id="btnLevelBar" rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxdj_xj') or
										s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxdj_bj') or
										s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxdj_sc')}">
											<f:facet name="left">
												<p:commandButton id="newLevelBtn" value="新建"
													rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxdj_xj')}"
													icon="ui-icon-plus" actionListener="#{riskFactorController.createNewLevel}"
													oncomplete="PF('saveRiskLevelDlg').show()" />
												<p:commandButton id="editLevelBtn" value="编辑"
													rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxdj_bj')}"
													icon="ui-icon-pencil" actionListener="#{riskFactorController.updateNewLevel}"
													disabled="#{riskFactorController.riskLevel==null}" update="rlform2:saveLevelDetail"
													oncomplete="PF('saveRiskLevelDlg').show()" />
												<p:commandButton value="删除" id="delLevelBtn"
													rendered="#{s:hasPermission(session,'xtsz_fxpgcssz_fxpgzdwh_fxdj_sc')}"
													icon="ui-icon-trash" update="factorLevelTb  msgs btnLevelBar"
													disabled="#{riskFactorController.riskLevel==null}"
													actionListener="#{riskFactorController.deleteLevel}">
													<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
												</p:commandButton>
											</f:facet>
										</p:toolbar>
										<p:dataTable var="item" id="factorLevelTb" widgetVar="factorRecordLevelTb"
											emptyMessage="无记录" value="#{riskFactorController.risklevels}" selectionMode="single"
											selection="#{riskFactorController.riskLevel}" rowKey="#{item.id}" rows="20"
											paginator="true" paginatorPosition="bottom"
											paginatorTemplate="{Customer} {CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
											rowsPerPageTemplate="20,50,100">
											<p:ajax event="rowSelect" update="rlform1:btnLevelBar"></p:ajax>
											<f:facet name="{Customer}">
												<p:outputLabel value="总计：#{riskFactorController.risklevels.size()}条纪录" />
											</f:facet>
											<p:column headerText="风险等级名称" style="text-align: center">
												<h:outputText value="#{item.name}" />
										    </p:column>
											<p:column headerText="对应颜色(中文)" style="text-align: center">
												<h:outputText value="#{item.color}" />
									    </p:column>
											<p:column headerText="对应颜色(英文)" style="text-align: center">
												<h:outputText value="#{item.engColor}" />
									    </p:column>
											<p:column headerText="对应颜色RGB值" style="text-align: center">
												<h:outputText value="#{item.rgbValue}" />
									    </p:column>
										</p:dataTable>
									</h:form>

									<h:form id="rlform2">
										<p:dialog widgetVar="saveRiskLevelDlg" header="风险等级" modal="true" id="saveRiskLevelDlg"
											width="350" height="260">
											<p:toolbar>
												<f:facet name="left">
													<p:commandButton id="saveLevelBtn" value="保存" icon="ui-icon-disk"
														oncomplete="PF('saveRiskLevelDlg').hide()"
														update="rlform1:factorLevelTb rlform1:msgs rlform1:btnLevelBar saveLevelDetail"
														actionListener="#{riskFactorController.saveRiskLevel}" />
												</f:facet>
											</p:toolbar>
											<p:outputPanel id="saveLevelDetail" style="text-align:center;">
												<p:panelGrid columns="2">
													<h:outputText value="风险等级名称" />
													<p:inputText label="name" value="#{riskFactorController.riskLevel.name}"></p:inputText>
													<h:outputText value="对应颜色(中文)" />
													<p:inputText label="color" value="#{riskFactorController.riskLevel.color}"></p:inputText>
													<h:outputText value="对应颜色(英文)" />
													<p:inputText label="engcolor" value="#{riskFactorController.riskLevel.engColor}"></p:inputText>
													<h:outputText value="对应颜色(RGB值)" />
													<p:inputText label="rgb" value="#{riskFactorController.riskLevel.rgbValue}"></p:inputText>
												</p:panelGrid>
											</p:outputPanel>
										</p:dialog>
									</h:form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</p:outputPanel>
		</div>
	</ui:define>
</ui:composition>
